﻿using System;
using System.Data;
using System.IO;
using System.Xml;
using System.Configuration;
using System.ComponentModel;
using System.Collections.Generic;

namespace GreatB2C.Config.SiteInfo
{
    public class UIConfig
    {
        public static string WebDAL = ConfigurationManager.AppSettings[ "WebDAL" ];

        public static string TableNamePrefix = ConfigurationManager.AppSettings[ "TableNamePrefix" ];

        #region 网站信息设置
        /// <summary>
        /// 网站名称
        /// </summary>
        public static string SiteName
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "SiteName" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "SiteName" , value );
            }
        }

        /// <summary>
        /// 网站标题
        /// </summary>
        public static string SiteTitle
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "SiteTitle" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "SiteTitle" , value );
            }
        }

        /// <summary>
        /// 网站地址
        /// </summary>
        public static string SiteAddress
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "SiteAddress" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "SiteAddress" , value );
            }
        }

        /// <summary>
        /// LOGO地址
        /// </summary>
        public static string LogoAddress
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "LogoAddress" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "LogoAddress" , value );
            }
        }

        /// <summary>
        /// Banner地址
        /// </summary>
        public static string BannerAddress
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "BannerAddress" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "BannerAddress" , value );
            }
        }

        /// <summary>
        /// 站长姓名
        /// </summary>
        public static string MasterName
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "MasterName" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "MasterName" , value );
            }
        }

        /// <summary>
        /// 站长信箱
        /// </summary>
        public static string MasterEmail
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "MasterEmail" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "MasterEmail" , value );
            }
        }

        /// <summary>
        /// 版权信息
        /// </summary>
        public static string Copyright
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "Copyright" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "Copyright" , value );
            }
        }

        /// <summary>
        /// 网站META关键词
        /// </summary>
        public static string SiteMeta
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "SiteMeta" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "SiteMeta" , value );
            }
        }

        /// <summary>
        /// 网站META网页描述
        /// </summary>
        public static string MetaDescription
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "MetaDescription" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "MetaDescription" , value );
            }
        }

        public static bool Config( string SiteName , string SiteTitle , string SiteAddress , string LogoAddress
            , string BannerAddress , string MasterName , string MasterEmail , string Copyright
            , string SiteMeta , string MetaDescription )
        {
            Dictionary<string , string> dicts = new Dictionary<string , string>( );

            dicts.Add( "SiteName" , SiteName );
            dicts.Add( "SiteTitle" , SiteTitle );
            dicts.Add( "SiteAddress" , SiteAddress );
            dicts.Add( "LogoAddress" , LogoAddress );
            dicts.Add( "BannerAddress" , BannerAddress );
            dicts.Add( "MasterName" , MasterName );
            dicts.Add( "MasterEmail" , MasterEmail );
            dicts.Add( "Copyright" , Copyright );
            dicts.Add( "SiteMeta" , SiteMeta );
            dicts.Add( "MetaDescription" , MetaDescription );

            return BaseConfig.SetConfigForBatch( BaseConfig.eConfigs.GreatB2C , dicts );
        }
        #endregion

        #region 网站参数设置
        /// <summary>
        /// 后台管理目录
        /// </summary>
        public static string ManageDir
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "ManageDir" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "ManageDir" , value );
            }
        }

        /// <summary>
        /// 管理员身份验证票过期时间
        /// </summary>
        public static string TicketTime
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "TicketTime" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "TicketTime" , value );
            }
        }

        /// <summary>
        /// 是否启用后台管理认证码
        /// </summary>
        public static string EnableSiteManageCode
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "EnableSiteManageCode" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "EnableSiteManageCode" , value );
            }
        }

        /// <summary>
        /// 后台管理认证码
        /// </summary>
        public static string SiteManageCode
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "SiteManageCode" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "SiteManageCode" , value );
            }
        }

        /// <summary>
        /// 管理员登录后台是否同时将前台关联用户登录
        /// </summary>
        public static string AdminIsLoginUser
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "AdminIsLoginUser" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "AdminIsLoginUser" , value );
            }
        }

        /// <summary>
        /// 管理员退出后台是否同时将前台关联用户退出
        /// </summary>
        public static string AdminIsLogoutUser
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "AdminIsLogoutUser" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "AdminIsLogoutUser" , value );
            }
        }

        /// <summary>
        /// 前台默认语言
        /// </summary>
        public static string CultureName
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "CultureName" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "CultureName" , value );
            }
        }

        /// <summary>
        /// 是否使用软键盘输入密码
        /// </summary>
        public static string EnableSoftKey
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "EnableSoftKey" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "EnableSoftKey" , value );
            }
        }

        /// <summary>
        /// 网站根域名
        /// </summary>
        public static string MainDomain
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "MainDomain" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "MainDomain" , value );
            }
        }

        /// <summary>
        /// 是否对数据库连接字符串加密
        /// </summary>
        public static string ConnProtecte
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "ConnProtecte" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "ConnProtecte" , value );
            }
        }

        /// <summary>
        /// 是否启用点券、金额、积分、有效期功能
        /// </summary>
        public static string PointMoneyExp
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "PointMoneyExp" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "PointMoneyExp" , value );
            }
        }

        /// <summary>
        /// 网站广告目录
        /// </summary>
        public static string ADDir
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "ADDir" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "ADDir" , value );
            }
        }

        /// <summary>
        /// 网站生成目录
        /// </summary>
        public static string CreateHtmlPath
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "CreateHtmlPath" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "CreateHtmlPath" , value );
            }
        }

        /// <summary>
        /// 内嵌代码生成路径
        /// </summary>
        public static string IncludeFilePath
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "IncludeFilePath" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "IncludeFilePath" , value );
            }
        }

        /// <summary>
        /// 网站模板根目录
        /// </summary>
        public static string TemplateDir
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "TemplateDir" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "TemplateDir" , value );
            }
        }

        /// <summary>
        /// 前台模板风格目录
        /// </summary>
        public static string SkinDirConfig
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "SkinDirConfig" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "SkinDirConfig" , value );
            }
        }

        /// <summary>
        /// 是否启用内容自动签收
        /// </summary>
        public static string IsAutoSignin
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "IsAutoSignin" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "IsAutoSignin" , value );
            }
        }

        /// <summary>
        /// 自动签收内容时间
        /// </summary>
        public static string AutoSigninTime
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "AutoSigninTime" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "AutoSigninTime" , value );
            }
        }

        /// <summary>
        /// 防刷新队列长度
        /// </summary>
        public static string RefreshQueueSize
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "RefreshQueueSize" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "RefreshQueueSize" , value );
            }
        }

        /// <summary>
        /// 采集休眠时间
        /// </summary>
        public static string CollectionSleep
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "CollectionSleep" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "CollectionSleep" , value );
            }
        }

        /// <summary>
        /// 是否启用防恶意刷新点击数功能
        /// </summary>
        public static string EnableRefreshHits
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "EnableRefreshHits" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "EnableRefreshHits" , value );
            }
        }

        /// <summary>
        /// 网站当前状态
        /// </summary>
        public static string SiteStatus
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "SiteStatus" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "SiteStatus" , value );
            }
        }

        /// <summary>
        /// 邮件确认模板管理
        /// </summary>
        public static string MailConfirmTemplate
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "MailConfirmTemplate" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "MailConfirmTemplate" , value );
            }
        }

        /// <summary>
        /// 邮件退订模板管理
        /// </summary>
        public static string MailUnsubscribe
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "MailUnsubscribe" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "MailUnsubscribe" , value );
            }
        }

        /// <summary>
        /// 维护说明
        /// </summary>
        public static string SiteMaintainDescription
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.GreatB2C , "SiteMaintainDescription" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.GreatB2C , "SiteMaintainDescription" , value );
            }
        }

        public static bool Config( string ManageDir , string TicketTime , string EnableSiteManageCode , string SiteManageCode
            , string AdminIsLoginUser , string AdminIsLogoutUser , string CultureName , string EnableSoftKey
            , string MainDomain , string ConnProtecte , string PointMoneyExp , string ADDir
            , string CreateHtmlPath , string IncludeFilePath , string TemplateDir , string IsAutoSignin
            , string AutoSigninTime , string RefreshQueueSize , string CollectionSleep , string EnableRefreshHits
            , string SiteStatus , string MailConfirmTemplate , string MailUnsubscribe , string SiteMaintainDescription )
        {
            Dictionary<string , string> dicts = new Dictionary<string , string>( );

            dicts.Add( "ManageDir" , ManageDir );
            dicts.Add( "TicketTime" , TicketTime );
            dicts.Add( "EnableSiteManageCode" , EnableSiteManageCode );
            dicts.Add( "SiteManageCode" , SiteManageCode );
            dicts.Add( "AdminIsLoginUser" , AdminIsLoginUser );
            dicts.Add( "AdminIsLogoutUser" , AdminIsLogoutUser );
            dicts.Add( "CultureName" , CultureName );
            dicts.Add( "EnableSoftKey" , EnableSoftKey );
            dicts.Add( "MainDomain" , MainDomain );
            dicts.Add( "ConnProtecte" , ConnProtecte );
            dicts.Add( "PointMoneyExp" , PointMoneyExp );
            dicts.Add( "ADDir" , ADDir );
            dicts.Add( "CreateHtmlPath" , CreateHtmlPath );
            dicts.Add( "IncludeFilePath" , IncludeFilePath );
            dicts.Add( "TemplateDir" , TemplateDir );
            dicts.Add( "SkinDirConfig" , SkinDirConfig );
            dicts.Add( "IsAutoSignin" , IsAutoSignin );
            dicts.Add( "AutoSigninTime" , AutoSigninTime );
            dicts.Add( "RefreshQueueSize" , RefreshQueueSize );
            dicts.Add( "CollectionSleep" , CollectionSleep );
            dicts.Add( "EnableRefreshHits" , EnableRefreshHits );
            dicts.Add( "SiteStatus" , SiteStatus );
            dicts.Add( "MailConfirmTemplate" , MailConfirmTemplate );
            dicts.Add( "MailUnsubscribe" , MailUnsubscribe );
            dicts.Add( "SiteMaintainDescription" , SiteMaintainDescription );

            return BaseConfig.SetConfigForBatch( BaseConfig.eConfigs.GreatB2C , dicts );
        }
        #endregion
    }
}
